class User < ApplicationRecord
  has_secure_password
  has_many :comments, dependent: :destroy, foreign_key: :user_id
  has_and_belongs_to_many :activities, join_table: "activities_users"
  validates :password, presence: true, length: { minimum: 1, maximum: 255 }
  validates :username, presence: true, length: { minimum: 1, maximum: 15 }, uniqueness: { case_sensitive: false }
  validates :email, presence: true
  validates :full_name, presence: true, length: { maximum: 30 }, allow_nil: false
  validates :cnt_break, length: { minimum: 0 }
  validates :cnt_finished, length: { minimum: 0 }
  validates :credit, length: { minimum: 0 }
end
